{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "b4639c3d",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(196608,) 196608\n",
      "174 174\n",
      "88 88\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAjAAAAGdCAYAAAAMm0nCAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/bCgiHAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAxXElEQVR4nO3df3AUdZ7/8VcSyPBzJgZMJjkCRFEgkKCghimVRclmwOjhkasSZYFVhIILlhAXMFccIn5vw+EqoiLclj/C1oECV6JromAIJqwyoGbJAUFTwsULHkziwiYDCAkk/f1jK32MBMiE/JhOno+qrmK639Pz6Q/DzItPf7onxDAMQwAAABYS2tENAAAACBQBBgAAWA4BBgAAWA4BBgAAWA4BBgAAWA4BBgAAWA4BBgAAWA4BBgAAWE63jm5AW2loaNDx48fVt29fhYSEdHRzAABAMxiGodOnTys2NlahoVceZ+m0Aeb48eOKi4vr6GYAAIAWOHbsmAYMGHDF7Z02wPTt21fS3zrAbrd3cGsAAEBz+Hw+xcXFmd/jV9JpA0zjaSO73U6AAQDAYq41/YNJvAAAwHIIMAAAwHKuK8CsXLlSISEhWrBggbnu/PnzysjIUL9+/dSnTx+lp6ersrLS73kVFRVKS0tTr169FBUVpUWLFunixYt+NYWFhRo9erRsNpuGDBminJyc62kqAADoRFocYL766iv9+7//u5KSkvzWL1y4UB999JG2bt2qoqIiHT9+XFOmTDG319fXKy0tTXV1ddqzZ482bNignJwcLVu2zKwpLy9XWlqa7rvvPpWUlGjBggV68skntWPHjpY2FwAAdCZGC5w+fdq45ZZbjPz8fOMXv/iF8fTTTxuGYRjV1dVG9+7dja1bt5q133zzjSHJ8Hg8hmEYxscff2yEhoYaXq/XrFm3bp1ht9uN2tpawzAM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ceKEubz77rt+26dNm6bS0lLl5+crNzdXu3fv1pw5c8ztPp9PqampGjRokIqLi/Xiiy9q+fLl+v3vfx9ocwEAQCcU8CmkSZMmadKkSVetsdlscjqdTW775ptvtH37dn311Ve64447JEmvvfaaHnjgAf3ud79TbGysNm7cqLq6Or399tsKDw/XiBEjVFJSopdfftkv6ABoGYb5AVhdm0ziLSwsVFRUlIYOHap58+bp5MmT5jaPx6OIiAgzvEhSSkqKQkNDtW/fPrNm3LhxCg8PN2vcbrfKysr017/+tcnXrK2tlc/n81sAAEDn1OoBZuLEifrDH/6ggoIC/du//ZuKioo0adIk1dfXS5K8Xq+ioqL8ntOtWzdFRkbK6/WaNdHR0X41jY8ba34uOztbDofDXOLi4lr70AAAQJBo9auQpk6dav45MTFRSUlJuvnmm1VYWKgJEya09suZsrKylJmZaT72+XyEGAAAOqk2vw/MTTfdpP79++vIkSOSJKfTqaqqKr+aixcv6tSpU+a8GafTqcrKSr+axsdXmltjs9lkt9v9FgAA0Dm1eYD54YcfdPLkScXExEiSXC6XqqurVVxcbNbs2rVLDQ0NSk5ONmt2796tCxcumDX5+fkaOnSobrjhhrZuMoBWwi8NA2grAQeYM2fOqKSkRCUlJZKk8vJylZSUqKKiQmfOnNGiRYu0d+9eff/99yooKNDkyZM1ZMgQud1uSdLw4cM1ceJEzZ49W19++aW++OILzZ8/X1OnTlVsbKwk6bHHHlN4eLhmzZql0tJSbd68WWvWrPE7RQQAALqugAPM119/rdtvv1233367JCkzM1O33367li1bprCwMB04cEB///d/r1tvvVWzZs3SmDFj9Kc//Uk2m83cx8aNGzVs2DBNmDBBDzzwgO655x6/e7w4HA59+umnKi8v15gxY/TMM89o2bJlXEINAAAktWAS7/jx42UYxhW379ix45r7iIyM1KZNm65ak5SUpD/96U+BNg8AAHQB/JgjAACwHAIMAACwHH6NGgAQEK4sQzAgwABdXOOX0fcr01p9nwDQVjiFBAAALIcAAwAALIdTSMDPcPoDAIIfIzAAAMByCDAAAMByOIUE4Jo4rQYg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Bj1X9UBBcAQHviRnZoMUILACvis6tzIMAAALqswc/mEWgsilNILWDV0zyBaO49V/iHD6AzuPQzryt8xncGBBhcEyEFQFfB5511cAqpi7vW8Cn/mAF0dZxmCk6MwAS55pzKuda2K9VxKggArozPxeBGgAlSV7vpW1NBpHEdoykAgK6AAGMR1xotIZwAQNtjgm/wYA5MEGjL86sEGwBoHXyeBhcCTBDhHwcAAM3DKaQORGABAGvjlFLHIcC0MkIJAHR+fNZ3vKA+hbR27VoNHjxYPXr0UHJysr788suObtJV8YYGAKB9BO0IzObNm5WZman169crOTlZr7zyitxut8rKyhQVFdXRzZPE0CEA4G+a+g8s3w1tK2hHYF5++WXNnj1bjz/+uBISErR+/Xr16tVLb7/9dkc37TLcpREAcDV8T7S+oByBqaurU3FxsbKyssx1oaGhSklJkcfjafI5tbW1qq2tNR/X1NRIknw+X6u3r6H2p1bfJwCgcxm4cOsV1x163n3ZtpHP7bjitq6k8XvbMIyr1gVlgPnLX/6i+vp6RUdH+62Pjo7Wt99+2+RzsrOz9fzzz1+2Pi4urk3aCABASzleadm2ruT06dNyOBxX3B6UAaYlsrKylJmZaT5uaGjQqVOn1K9fP4WEhLTa6/h8PsXFxenYsWOy2+2ttl/8Df3b9ujjtkX/ti36t20FQ/8ahqHTp08rNjb2qnVBGWD69++vsLAwVVZW+q2vrKyU0+ls8jk2m002m81vXURERFs1UXa7nX88bYj+bXv0cduif9sW/du2Orp/rzby0igoJ/GGh4drzJgxKigoMNc1NDSooKBALperA1sGAACCQVCOwEhSZmamZs6cqTvuuEN33XWXXnnlFZ09e1aPP/54RzcNAAB0sKANMI888oh+/PFHLVu2TF6vV7fddpu2b99+2cTe9maz2fTcc89ddroKrYP+bXv0cduif9sW/du2rNS/Ica1rlMCAAAIMkE5BwYAAOBqCDAAAMByCDAAAMByCDAAAMByCDABWrt2rQYPHqwePXooOTlZX375ZUc3yZKWL1+ukJAQv2XYsGHm9vPnzysjI0P9+vVTnz59lJ6eftmNDfF/du/erYceekixsb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175MgRY8WKFcbXX39tlJeXGx9++KFx0003GePGjTP3EYz9S4AJ0GuvvWYMHDjQCA8PN+666y5j7969Hd0kS3rkkUeMmJgYIzw83Pi7v/s745FHHjGOHDlibj937pzxT//0T8YNN9xg9OrVy/iHf/gH48SJEx3Y4uD22WefGZIuW2bOnGkYxt8upf6Xf/kXIzo62rDZbMaECROMsrIyv32cPHnSePTRR40+ffoYdrvdePzxx43Tp093wNEEn6v1708//WSkpqYaN954o9G9e3dj0KBBxuzZsy/7jw39e2VN9a0k45133jFrmvOZ8P333xuTJk0yevbsafTv39945plnjAsXLrTz0QSfa/VvRUWFMW7cOCMyMtKw2WzGkCFDjEWLFhk1NTV++wm2/g0xDMNov/EeAACA68ccGAAAYDkEGAAAYDkEGAAAYDkEGAAAYDkEGAAAYDkEGAAAYDkEGAAAYDkEGAAAYDkEGAAAYDkEGAAAYDkEGAAAYDkEGAAAYDn/H2YOPG2ikVcnAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import cv2 as cv\n",
    "from matplotlib import pyplot as plt\n",
    "\n",
    "img = cv.imread('../data/home.jpg',0)\n",
    "h,w = img.shape[0],img.shape[1]\n",
    "print(img.ravel().shape,w*h)\n",
    "\n",
    "#img.ravel表示把图像的二维数组展平成一维数组\n",
    "l=img.ravel().shape[0]\n",
    "#查看一维数组的最后一个和图片最右下像素的对比\n",
    "print(img.ravel()[l-1],img[h-1,w-1])\n",
    "print(img.ravel()[0],img[0,0])\n",
    "\n",
    "histSize = 256\n",
    "ranges = [0,256]\n",
    "#确定要统计的范围 ranges ，再定要显示的个数 histSize\n",
    "plt.hist(img.ravel(),histSize,ranges)\n",
    "plt.show()\n",
    "\n",
    "cv.imshow(\"img\",img)\n",
    "cv.waitKey(0)\n",
    "\n",
    "cv.destroyAllWindows()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "43425131",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.16"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
